import Ember from 'ember';
import BaseBusiness from '../base-business';
export default BaseBusiness.extend({
    queryParams: {
        id: {
            refreshModel: true
        },
        editMode: {
            refreshModel: true
        },
    },
    detailEdit: true,
    header_title: '基础设置详情',
    model() {
        return {};
    },
    setupController(controller, model) {
        this._super(controller, model);
        var editMode = this.getCurrentController().get('editMode');
        var id = this.getCurrentController().get('id');
        //物品列表下拉框
        if(editMode == 'edit'){
          let salarypositionsInfo = this.store.peekRecord('salaryposition',id);
          let isAdmin = salarypositionsInfo.get("isAdmin");
          console.log("salarypositionsInfo:", salarypositionsInfo, isAdmin);
          if(isAdmin == "1") {
            controller.set('isAdmin',"1");
          } else {
            controller.set('isAdmin',"0");
          }
          controller.set('salarypositionsInfo',salarypositionsInfo);
          controller.set('detailEdit',false);
        }else if(editMode == 'add'){
          let salarypositionsInfo = this.store.createRecord('salaryposition',{});
          controller.set('salarypositionsInfo',salarypositionsInfo);
          controller.salarypositionModelObs();
          controller.set('detailEdit',true);
          controller.set('isAdmin',"0");
        }
    }
});
